home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000098_icon-group-sender _Fri Apr 19 13:53:43 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Fri, 19 Apr 1996 19:14:12 MST
  2. Date: Fri, 19 Apr 1996 13:53:43 -0700
  3. Message-Id: <199604192053.NAA06439@dfw-ix2.ix.netcom.com>
  4. X-Sender: bobalex@ix.netcom.com
  5. X-Mailer: Windows Eudora Pro Version 2.1.2
  6. Mime-Version: 1.0
  7. Content-Type: text/plain; charset="us-ascii"
  8. To: icon-group@cs.arizona.edu
  9. From: Bob Alexander <bobalex@ix.netcom.com>
  10. Subject: Re: Making a list out of a generated sequence
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: O
  13.  
  14. Since I sent out the following:
  15.  
  16. >>    every tempList := put([], !"string")
  17. >
  18. >That is a VERY COOL Icon idiom -- wish I'd thought of it!
  19. >
  20. >It consumes a bit of time though, so for cases where that is bad the
  21. old-fashioned way is better.  I did some trivial timings of
  22. >
  23. >  every x := put([],1 to 500000)               (1)
  24. >
  25. >    vs.
  26. >
  27. >  x := []; every put(x,1 to 500000)            (2)
  28. >
  29. >and came out with about 7.5 vs. 5.7 sec -- apparently the cost of doing
  30. 1/2M >assignments.
  31.  
  32. ...I received this refinement independently from two separate Icon wizards
  33. who reside in different states:
  34.  
  35.    every put(x := [],1 to 500000)               (3)
  36.  
  37. It runs just as fast as (2), has the terseness if (1), and is maybe even a
  38. bit easier to comprehend than (1).  Thanks Steve and Clint -- this one's
  39. going into my permanent idiom collection.
  40.  
  41. -- Bob
  42.  
  43.